<template>
  <div class="div">
    <a-modal
      title="选择产品"
      :width="modalWidth"
      :visible="visible"
      :confirmLoading="confirmLoading"
      @ok="handleCancel"
      @cancel="handleCancel"
    >
      <a-spin tip="Loading..." :spinning="false">
        <a-table :columns="columns" :data-source="data">
          <span slot="action" slot-scope="text, record">
            <a @click="add(record)">选择</a>
          </span>
        </a-table>
      </a-spin>
    </a-modal>
  </div>
</template>

<script>
import { gkakRJianKangXinXiData } from '@/api/api'
export default {
  name: 'JSelectDepartModal',
  props: ['modalWidth', 'multi', 'rootOpened', 'departId'],
  data() {
    return {
      visible: false,
      confirmLoading: false,
      // treeData: [],
      // autoExpandParent: true,
      // expandedKeys: [],
      // dataList: [],
      // checkedKeys: [],
      // checkedRows: [],
      // searchValue: '',
      data: [],
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '名称',
          align: 'center',
          dataIndex: 'name',
        },
        {
          title: '协议类型',
          align: 'center',
          dataIndex: 'protocolType_dictText',
        },
        {
          title: '数据格式',
          align: 'center',
          dataIndex: 'dataFormat_dictText',
        },
        {
          title: '状态',
          align: 'center',
          dataIndex: 'releaseStatus_dictText',
        },
        {
          title: '设备类型',
          align: 'center',
          dataIndex: 'deviceType',
        },
        {
          title: '所属行业',
          align: 'center',
          dataIndex: 'industry',
        },
        {
          title: '产品状态',
          align: 'center',
          dataIndex: 'status_dictText',
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          // fixed:"right",
          width: 147,
          scopedSlots: { customRender: 'action' },
        },
      ],
    }
  },
  created() {
    this.loadDepart()
  },
  watch: {
   
  },
  methods: {
    show() {
      this.visible = true
     
    },
    loadDepart() {
      internetProductList().then((res) => {
        
        if (res.success) {
          this.data = res.result.records
        }
      })
    },

    handleCancel() {
      this.visible = false
    },
  
    // 选择产品
    add(val){
      console.log(val.id)
       this.$emit('ok', val.id)
      this.visible = false
    }
  },
}
</script>

<style scoped>
.ant-modal-wrap >>> .ant-modal {
  width: 1200px !important;
}
</style>